<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <title>基于微服务架构的信息分享社区的设计与实现</title>
    <head th:insert="~{import :: head}"></head>
</head>
<body>
<div th:replace="navigation :: nav"></div>
<div class="container-fluid main profile">
    <div class="row">
        <div class="col-md-9 col-md-12 col-sm-12 col-xs-12">
            <h3>
                <span class="glyphicon glyphicon-list" aria-hidden="true"></span>
                <span th:if="${section.equals('questions')}" th:text="我的问题"></span>
                <span th:if="${section.equals('replies')}" th:text="最新回复"></span>
                <span th:if="${section.equals('draft')}" th:text="我的草稿"></span>
            </h3>
            <hr/>

            <!--我的问题区域-->
            <div th:if="${section.equals('questions')}" class="media" th:each="question : ${questions}">
                <div class="media-left">
                    <a href="#">
                        <img class="media-object img-rounded" th:src="${question.user.avatarUrl}" alt="avatar.jpg">
                    </a>
                </div>
                <div class="media-body">
                    <a th:href="@{'/question/?id='+${question.getId()}}">
                        <h5 class="media-heading" th:text="${question.title}"></h5>
                    </a>
                    <span th:text="${question.description}"></span>&nbsp;
                    <span class="text-desc">•
                        <span th:text="${question.commentCount}"></span> 个回复 •
                        <span th:text="${question.viewCount}"></span> 次浏览 •
                        <span th:text="${question.likeCount}"></span> 个喜欢 •
                        <span th:text="${question.pubtime}"></span>
                    </span>
                    <!--编辑按钮-->
                    <a th:href="@{'/publish/'+${question.getId()}}" class="question-modify-icon pull-right">
                        <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> 编辑
                    </a>
                </div>
                <hr th:unless="${question.equals(questions.get(questions.size()-1))}">
            </div>

            <!--回复区域-->
            <div th:if="${section.equals('replies')}" class="media"
                 th:each="notification, notificationState : ${notifications}">
                <div class="replies">
                    <span th:text="${notification.notifierName +' ' + notification.typeInfo + ' '}"></span>
                    <a th:href="'/notification/'+ ${notification.id}">
                        <span class="" th:text="${notification.outerTitle}"></span>
                    </a>
                    <span th:class="${notification.status==0?'label label-danger':'label label-info'}"
                          th:text="${notification.status==0?'未读':'已读'}"></span>
                    <span class="pull-right replies-time"
                          th:text="${#dates.format(notification.gmtCreate,'yyyy-MM-dd HH:mm')}"></span>
                </div>
                <hr th:unless="${notificationState.last}">
            </div>

            <!--分页页码区域-->
            <nav aria-label="Page navigation" class="pull-right">
                <ul class="pagination">
                    <!--首页-->
                    <li th:if="${pageInfo.getShowFirstPage()}">
                        <a th:href="@{'/profile/'+ ${section}(currPage=1)}" aria-label="First">
                            <span aria-hidden="true">&laquo;</span>
                        </a>
                    </li>

                    <!--上一页-->
                    <li th:if="${pageInfo.getShowPrevPage()}">
                        <a th:href="@{'/profile/'+ ${section}(currPage=${pageInfo.getCurrPage()-1})}"
                           aria-label="Previous">
                            <span aria-hidden="true">&lt;</span>
                        </a>
                    </li>

                    <!--显示页-->
                    <li th:if="${pageInfo.getEndPage() != 0}" th:each="page : ${pageInfo.getPages()}"
                        th:class="${pageInfo.currPage == page}? 'active' : ''">
                        <a th:href="@{'/profile/'+ ${section}(currPage=${page})}" th:text="${page}"
                           aria-label="Pages"></a>
                    </li>

                    <!--下一页-->
                    <li th:if="${pageInfo.getShowNextPage()}">
                        <a href="#" th:href="@{'/profile/'+ ${section}(currPage=${pageInfo.getCurrPage()+1})}"
                           aria-label="Next">
                            <span aria-hidden="true">&gt;</span>
                        </a>
                    </li>

                    <!--尾页-->
                    <li th:if="${pageInfo.getShowEndPage()}">
                        <a th:href="@{'/profile/'+ ${section}(currPage=${pageInfo.getEndPage()})}" aria-label="End">
                            <span aria-hidden="true">&raquo;</span>
                        </a>
                    </li>
                </ul>
            </nav>
        </div>
        <div class="col-md-3 col-md-12 col-sm-12 col-xs-12">
            <!-- 列表组 -->
            <div class="list-group section">
                <a href="/profile/questions"
                   th:class="${section == 'questions'}? 'active list-group-item' : 'list-group-item'">我的问题</a>
                <a href="/profile/replies"
                   th:class="${section == 'replies'}? 'active list-group-item' : 'list-group-item'">
                    <span class="badge" th:text="${session.unreadCount}"></span>最新回复
                </a>
                <a href="/profile/draft" th:class="${section == 'draft'}? 'active list-group-item' : 'list-group-item'">我的草稿</a>
                <a href="#" class="list-group-item">我的收藏</a>
                <a href="#" class="list-group-item">我关注的问题</a>
            </div>
        </div>
    </div>
</div>
<div th:replace="footer :: foot"></div>
</body>
</html>